/* DeepSpeed Builder Modal - styled like Training Wizard */
.deepspeed-builder-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.deepspeed-builder-modal {
    width: 90vw;
    max-width: 900px;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    cursor: default;
    pointer-events: auto;
    position: relative;
    margin: auto;
}

.deepspeed-builder-modal .modal-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem 2rem;
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 16px 16px 0 0;
}

.deepspeed-builder-modal .modal-title {
    color: #f8fafc;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.deepspeed-builder-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 2rem 1.5rem;
    background: rgba(15, 23, 42, 0.98);
}

.deepspeed-builder-modal .modal-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1.5rem 2rem;
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 0 0 16px 16px;
}

.deepspeed-builder-modal h5 {
    margin-bottom: 0;
    color: #f8fafc;
}

.deepspeed-builder-modal p {
    color: #cbd5e1;
    margin-bottom: 0;
}

/* Wizard-style form controls */
.deepspeed-builder-modal .form-control,
.deepspeed-builder-modal .form-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #f8fafc;
    border-radius: 8px;
}

.deepspeed-builder-modal .form-control:focus,
.deepspeed-builder-modal .form-select:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    color: #f8fafc;
}

.deepspeed-builder-modal .form-control::placeholder,
.deepspeed-builder-modal .form-select::placeholder {
    color: #64748b;
}

.deepspeed-builder-modal .form-text {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Wizard-style cards and sections */
.deepspeed-builder-section {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.deepspeed-builder-section h6 {
    color: #f8fafc;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Wizard-style option cards */
.deepspeed-option-card {
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    margin-bottom: 1rem;
}

.deepspeed-option-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.deepspeed-option-card.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.deepspeed-option-card.selected::before {
    content: '✓';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
}

.deepspeed-option-card h6 {
    color: #f8fafc;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.deepspeed-option-card .option-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.deepspeed-option-card .text-muted {
    color: #94a3b8 !important;
}

.deepspeed-builder-modal .btn-mode {
    flex: 1 1 0;
}

.deepspeed-builder-modal .preview-panel {
    background-color: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: var(--bs-font-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
    font-size: 0.875rem;
    max-height: 240px;
    overflow: auto;
    white-space: pre;
}

.deepspeed-builder-modal .badge-stage {
    font-size: 0.75rem;
}

.deepspeed-builder-modal .alert {
    border-radius: 0.5rem;
}

/* DeepSpeed Builder Button - styled like Wizard Launch Button */
.deepspeed-launch-btn {
    width: 100%;
    margin-bottom: 0.75rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

.deepspeed-launch-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.deepspeed-launch-btn:active {
    transform: translateY(0);
}

.deepspeed-launch-btn .btn-icon {
    margin-right: 0.5rem;
}

body.builder-modal-open {
    overflow: hidden;
}

/* Enhanced form controls matching application styling */
.deepspeed-builder-modal .form-control,
.deepspeed-builder-modal .form-select,
.deepspeed-builder-modal textarea {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    color: #f8fafc !important;
    border-radius: 8px;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease;
}

.deepspeed-builder-modal .form-control:focus,
.deepspeed-builder-modal .form-select:focus,
.deepspeed-builder-modal textarea:focus {
    background: rgba(15, 23, 42, 0.8) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
    color: #f8fafc !important;
    outline: none;
}

.deepspeed-builder-modal .form-control::placeholder,
.deepspeed-builder-modal .form-select::placeholder,
.deepspeed-builder-modal textarea::placeholder {
    color: #64748b !important;
}

.deepspeed-builder-modal .form-text {
    color: #94a3b8 !important;
    font-size: 0.8125rem !important;
    margin-top: 0.5rem;
}

/* Enhanced checkboxes matching application styling */
.deepspeed-builder-modal .form-check {
    display: flex !important;
    align-items: center !important;
    min-height: auto !important;
    padding-left: 0 !important;
    margin-bottom: 0.75rem !important;
}

.deepspeed-builder-modal .form-check-input {
    width: 1.125rem !important;
    height: 1.125rem !important;
    margin: 0 !important;
    margin-right: 0.5rem !important;
    float: none !important;
    position: relative !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer;
    border-radius: 4px !important;
}

.deepspeed-builder-modal .form-check-input:checked {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.deepspeed-builder-modal .form-check-label {
    margin-bottom: 0 !important;
    cursor: pointer;
    font-size: 0.875rem !important;
    line-height: 1.125rem !important;
    color: #cbd5e1 !important;
    font-weight: 500 !important;
}

/* Enhanced dropdown styling */
.deepspeed-builder-modal .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7 7-7'/%3e%3c/svg") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 1rem !important;
    padding-right: 2rem !important;
}

.deepspeed-builder-modal optgroup {
    background: rgba(30, 41, 59, 0.9) !important;
    color: #94a3b8 !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
}

.deepspeed-builder-modal optgroup option {
    background: rgba(15, 23, 42, 0.6) !important;
    color: #f8fafc !important;
    font-weight: normal !important;
    padding-left: 1rem !important;
}

/* Section dividers/headers */
.deepspeed-builder-section {
    background: rgba(30, 41, 59, 0.4) !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    border: 1px solid rgba(148, 163, 184, 0.1) !important;
    position: relative !important;
}

.deepspeed-builder-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.3) 50%, transparent 100%) !important;
}

.deepspeed-builder-section h6 {
    color: #f8fafc !important;
    font-weight: 600 !important;
    margin-bottom: 0.75rem !important;
    margin-top: 0.5rem !important;
}

/* Enhanced buttons inside modal */
.deepspeed-builder-modal .btn {
    padding: 0.5rem 1rem !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.deepspeed-builder-modal .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
}

.deepspeed-builder-modal .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

.deepspeed-builder-modal .btn-secondary {
    background: rgba(148, 163, 184, 0.2) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

.deepspeed-builder-modal .btn-secondary:hover {
    background: rgba(148, 163, 184, 0.3) !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

/* Enhanced alert styling */
.deepspeed-builder-modal .alert {
    border: none !important;
    border-radius: 8px !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
}

.deepspeed-builder-modal .alert-info {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
}

.deepspeed-builder-modal .alert-success {
    background: rgba(34, 197, 94, 0.1) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(34, 197, 94, 0.2) !important;
}

.deepspeed-builder-modal .alert-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(245, 158, 11, 0.2) !important;
}

/* Radio buttons styling */
.deepspeed-builder-modal .form-check-input[type="radio"] {
    width: 1rem !important;
    height: 1rem !important;
    border-radius: 50% !important;
}

.deepspeed-builder-modal .form-check-input[type="radio"]:checked {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.deepspeed-builder-modal .form-check-input[type="radio"]::after {
    content: '';
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 50%;
    background: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Input groups */
.deepspeed-builder-modal .input-group {
    display: flex !important;
    align-items: stretch !important;
}

.deepspeed-builder-modal .input-group .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.deepspeed-builder-modal .input-group .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-left: none !important;
}
